package Chinese.Education.Identify.controller;

import Chinese.Education.Identify.pojo.Course;
import Chinese.Education.Identify.service.CourseService;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/course")
public class CourseController {
    @Resource
    private CourseService courseService;
    @RequestMapping(value = "/select" , method = RequestMethod.GET)
    public Map<String, Object> selectCourse(@RequestParam(value = "page",  defaultValue = "1") int page,
                                            @RequestParam(value = "limit",  defaultValue = "10") int limit,
                                            String courseId,
                                            String courseName)
    {
        return courseService.selectCourse(page, limit, courseId, courseName);
    }

    @RequestMapping(value = "/insert" , method = RequestMethod.POST)
    public Map<String, Object> insertCourse(@RequestBody Course course)
        {
        return courseService.insertCourse(course);
    }

    @RequestMapping(value = "/delete" , method = RequestMethod.POST)
    public Map<String, Object> deleteCourse(@RequestBody Course course)
        {
            return courseService.deleteTeacher(course);
        }

    @RequestMapping(value = "/update" , method = RequestMethod.POST)
    public Map<String, Object> updateCourse(@RequestBody Course course)
        {
            return courseService.updateTeacher(course);
        }

}
